package com.cs.study.homework.test;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.Objects;
import java.util.Scanner;
import java.util.stream.Stream;

public class Demo5 {
    public static void main(String[] args) {
        Student2[] student2s = new Student2[10];
        Scanner sc = new Scanner(System.in);


        int index = 0;
        while (true) {
            String s = sc.nextLine();
            if (s.equals("exit")) {
                break;
            }
            String[] in = s.split(":");
            Student2 student2 = new Student2(Integer.parseInt(in[0]), in[1], Integer.parseInt(in[2]));
            if (index < student2s.length) {
                student2s[index] = student2;
            } else {
                System.out.println("full");
            }
        }

        for (Student2 student2 : student2s) {
            if (student2 != null) {
                System.out.println(student2);
            }
        }

        Stream<Student2> stream = (Stream<Student2>) Arrays.stream(student2s).filter(Objects::nonNull).toList();
        System.out.println(stream);


    }
}


@Data
@NoArgsConstructor
@AllArgsConstructor
class Student2 {
    int id;
    String name;
    int age;
}